package com.zzyl.controller;

import com.zzyl.base.PageResponse;
import com.zzyl.base.ResponseResult;
import com.zzyl.dto.AlertDataHandleDto;
import com.zzyl.dto.AlertDataPageQueryDto;
import com.zzyl.service.AlertDateService;
import com.zzyl.vo.AlertDataVo;
import io.swagger.annotations.Api;
import io.swagger.annotations.ApiOperation;
import io.swagger.v3.oas.annotations.parameters.RequestBody;
import lombok.extern.slf4j.Slf4j;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import java.time.LocalDateTime;

/**
 * @Description AlertDateController
 * @Author xiao  xun
 * @Date 2024-09-15
 */
@RestController
@RequestMapping("/alert-data")
@Api(tags = "报警数据")
@Slf4j
public class AlertDateController extends BaseController {

    @Autowired
    private AlertDateService alertDateService;

    @GetMapping("/pageQuery")
    @ApiOperation(value = "分页查询报警数据")
    public ResponseResult<PageResponse<AlertDataVo>> pageSelect(AlertDataPageQueryDto alertDataPageQueryDto) {
        PageResponse<AlertDataVo> alertDataVoPageResponse = alertDateService.pageSelect(alertDataPageQueryDto);
        return success(alertDataVoPageResponse);
    }

    @PutMapping("/handleAlertData/{id}")
    @ApiOperation(value = "处理设备报警数据")
    public ResponseResult handleAlertData(
                                            AlertDataHandleDto alertDataHandleDto) {
         alertDateService.handleAlertData(alertDataHandleDto);
        return success();
    }
}
